package package01;

public class Bicycle extends Transport{

    private boolean hasGear;

      public Bicycle(String name, double speed, boolean hasGear){
          super(name, speed);
          this.hasGear = hasGear;
      }
    @Override
    public void showMoveWay() {
        String gearInfo = hasGear ? "变速" : "单速";
        System.out.println("自行车" + gearInfo + "移动");
    }

    @Override
    public void showProperties() {
          super.showProperties();
          System.out.println("齿轮：" + (hasGear ? "有" : "没"));
    }

    public boolean isHasGear() {
        return hasGear;
    }

    public void setHasGear(boolean hasGear) {
        this.hasGear = hasGear;
    }
}
